/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.FetchType;

/**
 *
 * @author Jacko
 */
@Entity
public class Transactions implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long transID;
    private Timestamp transDate;
    private String transName; //added by Tony
    private String transDesc;
    private Double transAmt;
    private int transDiscount; //added by tony
    private String status;
    

    
    @ManyToOne(targetEntity = Stakeholder.class, cascade = {CascadeType.ALL},
    fetch = FetchType.EAGER)
    private Stakeholder stakeholder;

    public Long getTransID() {
        return transID;
    }

    public void setTransID(Long transID) {
        this.transID = transID;
    }

    public Timestamp getTransDate() {
        return transDate;
    }

    public void setTransDate(Timestamp transDate) {
        this.transDate = transDate;
    }
    
    public String getTransName(){
        return transName;
    }
    
    public void setTransName(String transName) {
        this.transName = transName;
    }

    public String getTransDesc() {
        return transDesc;
    }

    public void setTransDesc(String transDesc) {
        this.transDesc = transDesc;
    }

    public Double getTransAmt() {
        return transAmt;
    }

    public void setTransAmt(Double transAmt) {
        this.transAmt = transAmt;
    }
    
    public int getTransDiscount() {
        return transDiscount;
    }
    
    public void setTransDiscount(int transDiscount) {
        this.transDiscount = transDiscount;
    }
    
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Stakeholder getStakeholder() {
        return stakeholder;
    }

    public void setStakeholder(Stakeholder stakeholder) {
        this.stakeholder = stakeholder;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getTransID() != null ? getTransID().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transactions)) {
            return false;
        }
        Transactions other = (Transactions) object;
        if ((this.getTransID() == null && other.getTransID() != null) || (this.getTransID() != null && !this.transID.equals(other.transID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Transactions[ id=" + getTransID() + " ]";
    }

}
